package com.shangma.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

@Component
public class AsyncManager {
    @Autowired
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;

    public void execute(Runnable r){
        // 从容器中得到线程池对象
        threadPoolTaskExecutor.execute(r);
    }
}
